Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[offboard control] allow for direct actuator control #22222

Merged
merged 2 commits into from
Nov 23, 2023

Conversation

beniaminopozzan
Copy link
Member

@beniaminopozzan beniaminopozzan commented Oct 15, 2023

EDITED on 2023/11/18

Solved Problem

  • The actuator flag of the offboard_control_mode was referring to thrust and torque control, requesting vehicle_thrust_setpoints and vehicle_torque_setpoint.
  • direct actuator control (bypassing the control allocator) was not possible.

Solution

  • The current actuator flag of the offboard_control_mode is renamed thrust_and_torque.
  • The new actuator direct_actuator flag disables the control allocator module. The offboard controller has then to provide actuator_motors and actuator_servos messages.
  • New topics added to the uxrce_dds bridge (subscriptions). No additioal load is introduced as the topics are only used if published by the offboard controller.
    • vehicle_thrust_setpoints and vehicle_torque_setpoint
    • actuator_motors and actuator_servos
  • The old actuator flag is removed after considering the risks related to keeping it.

Changelog Entry

For release notes: new feature: direct actuator control in offboard mode
Documentation: Need to clarify page https://docs.px4.io/main/en/flight_modes/offboard.html

Copy link
Member

@Jaeyoung-Lim Jaeyoung-Lim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I do like the change, I am a bit concerned in replacing an existing flag and reusing it for something else. Especially for something that is risky as actuator controls.

@beniaminopozzan
Copy link
Member Author

@Jaeyoung-Lim I see your point, any suggestion for having a "smoother" transition then?
I really don't like having actuator behaving like thrust and torque as it is right now.

What about introducing thrust_and_torque and instead of having actuator, using motor_and_servo? Or anything else but actuator

@utkarsh867
Copy link

utkarsh867 commented Oct 19, 2023

I hate to suggest this, but changing actuator to actuators could possibly avoid issues in existing projects?

@beniaminopozzan
Copy link
Member Author

On second thought, with the current naming proposal, using actuator=true and then sending thrust and torque setpoints will simply do nothing as the control allocator is disabled. I don't think it is such a bad behaviour... unless you switch to offbaoard while the drone is already flying.

@dagar , any opinion on this?

@Jaeyoung-Lim
Copy link
Member

unless you switch to offbaoard while the drone is already flying.

For me this is the default way to engage offboard mode, since it is the safest way to fall back into previous mode and bypass different phases of flight (e.g. spool up during takeoff)

@beniaminopozzan
Copy link
Member Author

Mhhh, I see.
Then I guess actuators may be a good tradeoff as @utkarsh867 suggested

@Jaeyoung-Lim
Copy link
Member

@LShivaRudra Please do not highjack the topic of this PR. You can either post a new issue or post questions on discuss.px4.io

@DronecodeBot
Copy link

This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/px4-maintainers-call-november-14-2023/35183/1

@beniaminopozzan beniaminopozzan force-pushed the pr-split-actuator-and-thrusttorque-offboard branch from 92bf63c to 3cf48ff Compare November 18, 2023 18:27
@beniaminopozzan
Copy link
Member Author

@Jaeyoung-Lim new proposal direct_actuator :)

@dagar, I agree with you that a proper separation between external inputs and internal ones should be enforced at topic-name-level to, among other things, increase safety.
However, in the meantime I think that this PR adds a feature that has been requested for some time now.

New thrust and torque control mode added which replaces the previous
actuator mode,
in this mode the rate controllers are disables, the control allocator
is enabled and the used externally provices
vehicle_thrust_setpoints and vehicle_torque_setpoints.

New direct_actuator mode
In direct_actuator mode the control allocator module does not publish
actuator_motors and actuator_servos messages which must instead be
provided extrernally by the user.

Removed old direct mode.

Signed-off-by: Beniamino Pozzan <beniamino.pozzan@gmail.com>
actuator_motors and actuator_servos subscribers for offboard control

Being subscribers, this does not increase the computational load
over the uxrce_dds brigde

Signed-off-by: Beniamino Pozzan <beniamino.pozzan@gmail.com>
@beniaminopozzan beniaminopozzan force-pushed the pr-split-actuator-and-thrusttorque-offboard branch from 3cf48ff to bbb06df Compare November 22, 2023 22:08
@dagar dagar merged commit 742d237 into main Nov 23, 2023
88 of 89 checks passed
@dagar dagar deleted the pr-split-actuator-and-thrusttorque-offboard branch November 23, 2023 03:14
@MaEtUgR MaEtUgR mentioned this pull request Nov 23, 2023
@MaEtUgR
Copy link
Member

MaEtUgR commented Nov 23, 2023

This one is quite dangerous. If a mode doesn't have the allocation flag set then the drone directly crashes which it currently does in Orbit because the flag was probably forgotten to be added. Here's the fix:
#22438

@DronecodeBot
Copy link

This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/problems-with-some-px4-ros-topics/35854/4

@DronecodeBot
Copy link

This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/drone-unstable-in-offboard-direct-motor-control/36383/6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants